<extend name="Common@Layout:hui-admin" />
<block name="title"><title>Administator管理后台</title></block>
<block name="style">
</block>

<block name="main">
	<nav class="breadcrumb">
		<i class="Hui-iconfont"></i>
		 首页 <span class="c-gray en">&gt;</span>
		 订单管理 <span class="c-gray en">&gt;</span>  
		 订单列表 
		<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
	</nav>
	
	<div class="pd-20">
		<div class="text-c"> 
			<form status="{:u('index')}" method="get" id="form">
			  <span class="select-box inline">
			<php>
				$searchtypes = array(
						'ddbh'=>'订单编号',
						'stuname'=>'学生姓名',
						'tel'=>'电话'
					);
			</php>
			<select name="searchtype" class="select">
				<foreach name="searchtypes" item="vo">
					<option value="{$key}" <eq name="_GET['searchtype']" value="$key">selected</eq>>{$vo}</option>
				</foreach>
			</select>
			</span> 日期范围：
			<input type="text" name="start_time" value="{$_GET['start_time']}" class="input-text mini-time" style="width:120px;">
			-
			<input type="text" name="end_time" value="{$_GET['end_time']}" class="input-text mini-time" style="width:120px;">
			<input type="text" name="keywords" value="{$_GET['keywords']}" id="" placeholder="标题关键词" style="width:250px" class="input-text">
			<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont"></i> 搜索</button>
			</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20"> 
			<div class="btn-group l">
				<a href="{:U('index',array('status'=>0))}" class="btn btn-default <if condition='$_GET[status] eq 0'>btn-primary</if> radius">全部</a>
				<a href="{:U('index',array('status'=>1))}" class="btn btn-default <if condition='$_GET[status] eq 1'>btn-primary</if> radius">已支付</a>
			  	<a href="{:U('index',array('status'=>2))}" class="btn btn-default <if condition='$_GET[status] eq 2'>btn-primary</if> radius">未支付</a>
			  	<a href="{:U('index',array('status'=>3))}" class="btn btn-default <if condition='$_GET[status] eq 3'>btn-primary</if> radius">已过期</a>
			</div>
			<if condition="$role eq 'ROLE_SUPER_ADMIN'">
			<span class="l ml-20"> 
				<a href="javascript:;" class="btn btn-danger radius ajax-post confirm" target-form="mini-form" data-msg="确定批量删除？" data-url="{:U('Orderadmin/del')}"><i class="Hui-iconfont"></i> 批量删除</a> 
			</span> 
			</if>
		</div>
		<php>
			$xiaoqu = R('Apiadmin/getxiaoqurole');
			if($xiaoqu){
				$map['did'] = array('in',$xiaoqu);
			}
			$map['type'] = array('not in',array('midbm','kjbm'));
			$result = _get_list_data('/Ygcl/Orderadmin/index/',$_GET,$map,D('YgclOrder'));
		</php>
		<form class="mini-form">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr>
					<th scope="col" colspan="11"><a class="btn btn-primary radius" href="{:U('export',$_GET)}">导出数据并生成excel</a> </th>
				</tr>
				<tr class="text-c">
					<th width="25"><input type="checkbox" name="" value=""></th>
					<th width="50">ID</th>
					<th width="140">订单编号</th>
					<th>用户</th>
					<th>类型</th>
					<th>学生姓名</th>
					<th>电话</th>
					<th width="60">费用</th>
					<th width="150"><if condition="$_GET['status'] eq 1">微信订单号<elseif condition="$_GET['status'] eq 3 or $_GET['status'] eq 2"/>过期时间</if></th>
					<th width="60">状态</th>
					<th width="120">操作</th>
				</tr>
			</thead>
			<tbody>
				<php>$type = C('ORDER_TYPE');</php>
				<foreach name="result['data']['list']" item="vo">
				<tr class="text-c">
					<td><input type="checkbox" value="{$vo['id']}" name="ids[]"></td>
					<td>{$vo['id']}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['ddbh'])}</td>
					<td>{$vo.user.realname|default=$vo['user']['nickname']}</td>
					<td>{$type[$vo['type']]}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['stuname'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['tel'])}</td>
					<td>{$vo.total}</td>
					<td><if condition="$vo['status'] eq 1">{$vo.wxddh}<else/>{$vo.token_time|date='Y-m-d H:i:s',###}</if></td>
					<td class="td-status">
						<if condition="$vo['status'] eq 1">
						<span class="label label-success radius">已支付</span>
						</if>
						<if condition="$vo['status'] eq 2">
						<span class="label label-default radius">未支付</span>
						</if>
						<if condition="$vo['status'] eq 3">
						<span class="label label-default radius">已过期</span>
						</if>
					</td>
					<td class="f-14 td-manage">
						<a style="text-decoration:none" href="javascript:;" onclick="open_iframe_dialog('{:U('orderadmin/detail',array(id=>$vo['id']))}','订单详情',['600px','600px'],1)" title="订单详情"><i class="Hui-iconfont"></i></a> 
            			<!-- <a style="text-decoration:none" class="ml-5 mini_del" data-url="{:U('orderadmin/del','ids='.$vo['id'])}" href="javascript:;" title="删除"><i class="Hui-iconfont"></i></a> -->
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		</form>
		{$result['pagetpl']}
	</div>
	
	
</block>

<block name="script">
<script>
$(function(){
	$('.mini-time').datepicker();
});
</script>
</block>